<!--
 * @Descripttion: 
 * @version: 1.0
 * @Author: LiYansheng
 * @Date: 2022-05-07 16:38:19
 * @LastEditors: CoderXZ
 * @LastEditTime: 2022-05-07 20:44:36
-->
<template>
  <div>
    <div id="pp1" style="width: 400px; height: 400px"></div>
  </div>
</template>

<script>
import { getAnalyze } from "../../api/analyze.js";
export default {
  // 传入数据对象myData,属性data数组，属性title标题
  // props: ["myData"],
  data() {
    return {};
  },
  methods: {},
  mounted() {
    var chartDom = document.getElementById("pp1");
    var myChart = this.$echarts.init(chartDom);
    var option;

    option = {
      title: {
        text: "",
        left: "center",
      },
      tooltip: {
        trigger: "item",
      },
      legend: {
        orient: "vertical",
        left: "left",
      },
      series: [
        {
          name: "",
          type: "pie",
          radius: "50%",
          data: [],
          emphasis: {
            itemStyle: {
              shadowBlur: 10,
              shadowOffsetX: 0,
              shadowColor: "rgba(0, 0, 0, 0.5)",
            },
          },
        },
      ],
    };
    getAnalyze()
      .then((result) => {
        if (result.status == "200") {
          console.log(result.data.sexRatio);
          option.series[0].data = result.data.haveSigned;
          myChart.setOption(option);
        }
      })
      .catch((err) => {});
  },
};
</script>

<style></style>
